import { defineStore } from 'pinia';

export const useContactStore = defineStore('contact', {
  state: () => ({
    contacts: [],
    loaded: false
  }),
  actions: {
    setContacts(contacts) {
      this.contacts = contacts;
      this.loaded = true;
    },
    getContactById(id) {
      return this.contacts.find(c => c.id === id);
    }
  }
});